﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;

namespace SBPweb.Forge.Controls.Silverlight.Utilities
{

    public class AnimationHelper
    {

        public static Storyboard GetStory(Control sender, FrameworkElement element, string storyName)
        {
            string dis = string.Empty;
            if (!sender.IsEnabled)
            {
                dis = "Disabled";
            }
            Storyboard sb = (element.FindName(storyName + dis) as Storyboard);
            //if (sb != null)
            //{
            //    sb.Stop();
            //    foreach (Timeline tl in sb.Children)
            //    {
            //        tl
            //        Storyboard.SetTarget(tl, element);
            //    }
            //}
            return sb;
        }

        public static Storyboard StartStory(Control sender, FrameworkElement element, string storyName)
        {
            Storyboard sb = GetStory(sender, element, storyName);
            sb.Begin();
            return sb;
        }

    }

}
